from functools import *
from toolz.curried import *

def pprint(x):
    import pprint
    pprint.pprint(x)

def getter(attr):
    return partial(flip(getattr), attr)

def first_or_none(seq):
    try:
        return first(seq)
    except StopIteration:
        return None

def pluck(dictionary: dict, *keys): 
     return [dictionary[key] for key in keys]

def apply(f, *args):
    *args, argseq = args
    args.extend(argseq)
    return f(*args)

def is_empty(seq):
    return len(seq) == 0

not_empty = complement(is_empty)

def is_none(x):
    return x is None

is_some = complement(is_none)

equals = curry(operator.eq)

less_than = curry(operator.lt)

remove = curry(lambda f,seq: filter(complement(f),seq))
